$(function () {
  
    // 请求数据
    $.ajax({
        url:`http://39.101.217.150:8075/banner/list`,
        type:'post',
        success:function (data) {
            var records = data.data;
            $.each(records,function (index,item) {
                $('.swiper-wrapper').append(`
                
                <div class="swiper-slide"><img src="${item.url}" src='./img/loading.jpg' alt=""></div>
                `)
            })

            var mySwiper = new Swiper ('.swiper', {
                loop: true, // 循环模式选项
                
                // 如果需要分页器
                pagination: {
                  el: '.swiper-pagination',
                },
            
              })   
          }
    })
    
    // 开班计划的数据获取 
    $.ajax({
        url:`http://39.101.217.150:8075/classplan/list`,
        data:{
            page:1,
            size:3
        },
        type:'get',
        success:function (data) {
            var records = data.data.records;
            $.each(records,function (index,item) {
                $('.plan-list').append(
                    `
                    <li>
                    <div>
                        <img src="${item.imgurl}" alt="">
                    </div>
                    <div>
                        <h4>${item.name}</h4>
                        <p>零基础入门</p>
                        <p>开课时间：${item.classTime}</p>
                        <p><span>北京校区</span>
                        <a href="javascript:;">立即抢座</a>
                        </p>
                    </div>
                    </li>
                    
                    `
                )
              })

        }
    })
    // 开班项目的数据获取 
    $.ajax({
        url:`http://39.101.217.150:8075/apps/list`,
        data:{
            page:1,
            size:3
        },
        type:'get',
        success:function (data) {
            var records = data.data.records;
            $.each(records,function (index,item) {
                $('.project-list').append(
                    `
                    <li>
                    <div>
                        <img data-original="${item.imgurl}" src='./img/loading.jpg' alt="">
                    </div>
                    <div>
                        <h4>${item.appName}</h4>
                        <p>零基础入门</p>
                        <p>上架时间：${item.appTime}</p>
                        <p>
                        <span>小鹿线</span>
                        <a href="${item.appurl}">立即购买</a>
                        </p>
                    </div>
                    </li>
                    
                    `
                )
              })
              $('.project-list img').lazyload({
                container:$('section')
              })

        }
    })
  })